package com.example.demo;

import com.example.api.JobExecutor;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.json.JsonMapper;
import io.undertow.Undertow;
import io.undertow.server.HttpHandler;

/**
 * @author fanhang
 */
public class UndertowBoot {

    public static void main(String[] args) throws JsonProcessingException {
        JsonMapper jsonMapper = JsonMapper.builder().build();
        JobExecutor jobExecutor = new JobExecutor();
        HttpHandler httpHandler = new UndertowHandler(jsonMapper, jobExecutor);
        Undertow server = Undertow.builder().addHttpListener(9090, "localhost").setHandler(httpHandler).build();
        server.start();
    }

}
